package itbour.onetouchshow.bean;

/**
 * Created by Administrator on 2018/1/10.
 */

public class ToJsCallBackBean {
//     "name":"ParaError",    // 错误/警告名称, 暂时约定: NoResponse, ParaError,  NativeError, UserCancel
//             "code":2,       // 错误代码, 暂时约定: 1, 无此方法, 2, 参数错误, 3. 原生出错, 4, 用户取消,
//             "message" : "参数错误",  // 错误提示
//             "desc" : "改传的参数一个都没传, 这是你的参数: {}"   // 错误描述, 可与提示相同


    private String name;
    private int code;
    private String message;
    private String desc;
    private ErrorCode errorCode;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setErrorCode(ErrorCode errorCode) {
        this.errorCode = errorCode;
        code = errorCode.getCode();
        message = errorCode.getMessage();
        name = errorCode.getMessage();
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public enum ErrorCode {
        NoResponse(1, "NoResponse"),
        ParaError(2, "ParaError"),
        NativeError(3, "NativeError"),
        UserCancel(4, "UserCancel");

        private int code;
        private String message;

        ErrorCode(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }
}
